import sys
import cv2
#sys.path.append("D:/AIForTest/ultralytics-main/")
from ultralytics import YOLO
 
# Create a new YOLO model from scratch
#model = YOLO('yolov8n.yaml')
 
if __name__ == '__main__':
    model = YOLO('D:/BaiduNetdiskDownload/ultralytics-main2/ultralytics-main/yolov8n.pt')
    # Load a pretrained YOLO model (recommended for training)
   # model = YOLO('D:/BaiduNetdiskDownload/ultralytics-main2/ultralytics-main/runs/segment/train23/weights/best.pt')#9 
    # Train the model using the 'coco128.yaml' dataset for 3 epochs
    #results = model.train(data='coco128-seg.yaml', epochs=3,device=0)
    success = model.export(format='onnx')#,opset=12 opset=11
'''
from ultralytics import YOLO

# 加载模型
#model = YOLO("yolov8n.yaml")  # 从头开始构建新模型
model = YOLO("yolov8x-seg.pt")  # 加载预训练模型（建议用于训练）
model.train(data='coco128-seg.yaml', epochs=10, imgsz=640)
'''

'''
from ultralytics import YOLO
 
# Create a new YOLO model from scratch
#model = YOLO('yolov8n.yaml')
 
if __name__ == '__main__':
    model = YOLO('yolov8n.yaml')
    
    # Load a pretrained YOLO model (recommended for training)
    model = YOLO('yolov8n.pt')
    
    # Train the model using the 'coco128.yaml' dataset for 3 epochs
    results = model.train(data='coco128.yaml', epochs=3,device=0)
'''

